package com.andcard.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;

import android.util.Log;

public class IoUtil {

	public static LinkedList<String[]> importFile(File importFile, String separator){
		
		Log.d(Reference.TAG, "IoUtil.importFile");
		
		try{
			LinkedList<String[]> list = new LinkedList<String[]>();
			BufferedReader buf = new BufferedReader(new FileReader(importFile));
			String line;
			while ((line = buf.readLine()) != null){
				String [] tokens = line.split(separator);
				if (tokens != null){
					list.add(tokens);
				}
			}
			buf.close();
			return list;
		}catch(IOException ex){
			Log.e(Reference.TAG, MiscUtil.getStackTrace(ex));
			return null;
		}
	}
}
